package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Customer;
import com.atguigu.jxc.service.CustomerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/customer")
public class CustomerController {
    @Resource
    private CustomerService customerService;
    @PostMapping("/list")
    public Map<String, Object> listCustomer(Integer page, Integer rows, String  customerName){
        return customerService.list(page, rows, customerName);
    }

    @PostMapping("/save")
    public ServiceVO saveCustomer(Customer customer){
        return customerService.save(customer);
    }

    @PostMapping("/delete")
    public ServiceVO deleteCustomer(String ids){
        return customerService.delete(ids);
    }
}
